const koa = require('koa')
const fs = require('fs/promises')
const app = new koa()

// 异步中间件
const main = async function (ctx){
  ctx.response.type = 'html'
  ctx.response.body = await fs.readFile('./demos/template.html','utf8')
}

app.use(main)

app.listen(3000,()=>{
  console.log('server start at 3000');
})